package com.youbug.mall.coupon_sms.controller;


import com.youbug.common.vo.QueryVo;
import com.youbug.mall.coupon_sms.entity.SmsSpuBounds;
import com.youbug.mall.coupon_sms.service.ISmsSpuBoundsService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.youbug.common.vo.R;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 商品spu积分设置 前端控制器
 * </p>
 *
 * @author youbug
 * @since 2024-04-23
 */
@RestController
@RequestMapping("/smsSpuBounds")
public class SmsSpuBoundsController {
@Autowired
private ISmsSpuBoundsService smsSpuBoundsService;

    @PostMapping("/getSmsSpuBoundsPage")
    public R<IPage<SmsSpuBounds>> getSmsSpuBoundsPage(@RequestBody QueryVo<SmsSpuBounds> queryVo){

        IPage<SmsSpuBounds> smsSpuBoundss = smsSpuBoundsService.getSmsSpuBoundsPage(queryVo);

        return R.ok(smsSpuBoundss);
    }

    @GetMapping("/getSmsSpuBoundsById/{id}")
    public R<SmsSpuBounds> getSmsSpuBoundsById(@PathVariable Integer id){

        SmsSpuBounds smsSpuBounds = smsSpuBoundsService.getById(id);

        return R.ok(smsSpuBounds);
    }

    @PostMapping("/add")
    public R<Boolean> add(@RequestBody SmsSpuBounds smsSpuBounds){

        boolean save = smsSpuBoundsService.save(smsSpuBounds);

        return  R.ok(save);
    }

    @PostMapping("/update")
    public R<Boolean> update(@RequestBody SmsSpuBounds smsSpuBounds){

        boolean update = smsSpuBoundsService.updateById(smsSpuBounds);

        return  R.ok(update);
    }

    @GetMapping("/delete/{id}")
    public R<Boolean> delete(@PathVariable Integer id){

        boolean remove = smsSpuBoundsService.removeById(id);

        return  R.ok(remove);
    }
}

